package com.jfs.qy.utils;

import com.jfs.qy.constant.GlobalConstant;
import com.jfs.qy.enums.NvrApiEnum;
import com.jfs.qy.properties.ExecutorProperties;
import com.jfs.qy.properties.NvrProperties;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * @Description 构建api请求地址
 * @E-mail cwm3412638@163.com
 * @Author cwm
 * @Date 2022/11/4
 */
@Component
@AllArgsConstructor
public class SystemCommonUtils {
    private final NvrProperties nvrProperties;
    private final ExecutorProperties executorProperties;

    /**
     * 获取api请求地址
     *
     * @param nvrApiEnum
     * @return
     */
    public String getRequestUrl(NvrApiEnum nvrApiEnum) {
        return GlobalConstant.HTTPS_PREFIX + this.nvrProperties.getServerIp() + nvrApiEnum.getUrl();
    }

    /**
     * 获取nvr服务ip地址
     *
     * @return
     */
    public String getServerIp() {
        return this.nvrProperties.getServerIp();
    }

    /**
     * 获取Nvr账号
     *
     * @return
     */
    public String getAcount() {
        return this.nvrProperties.getUserAccount();
    }

    /**
     * 获取Nvr账号密码
     *
     * @return
     */
    public String getPasswd() {
        return this.nvrProperties.getUserPassWord();
    }

    /**
     * 获取心跳间隔时间
     *
     * @return
     */
    public long getHeartBeatInterval() {
        return this.executorProperties.getHeartBeatInterval();
    }

    /**
     * 获取查询系统详情时间间隔
     *
     * @return
     */
    public long getSystemInfoInterval() {
        return this.executorProperties.getSystemInfoInterval();
    }

    /**
     * 获取查询告警间隔时间
     * @return
     */
    public long getAlarmInterval() {
        return this.executorProperties.getAlarmInterval();
    }

    /**
     * 获取查询系统ipc列表详情时间间隔
     * @return
     */
    public long getSystemIpcListInfoInterval(){
        return this.executorProperties.getSystemIpcListInfoInterval();
    }

    /**
     * 获取处理告警事件间隔时间
     * @return
     */
    public long getProcessAlarmInterval(){
        return this.executorProperties.getProcessAlarmInterval();
    }

    /**
     * 获取录制告警视频时间
     * @return
     */
    public long getRecordAlarmTime(){
        return this.nvrProperties.getRecordAlarmTime();
    }

    /**
     * 获取临时存储视频地址
     * @return
     */
    public String getTemporaryVideoStoragePath(){
        return this.nvrProperties.getTemporaryVideoStoragePath();
    }

    /**
     * 获取处理告警视频线程数量
     * @return
     */
    public long getRecordAlarmThread(){
        return this.nvrProperties.getRecordAlarmThread();
    }


    /**
     * 获取视频第一帧画面存储临时路径
     * @return
     */
    public String getTemporaryImageStoragePath(){
        return this.nvrProperties.getTemporaryImageStoragePath();
    }


    /**
     * 获取存储录制视频封面图存储oss桶名称
     * @return
     */
    public String getCoverBucketName(){
        return this.nvrProperties.getCoverBucketName();
    }
}
